﻿using System;
using System.Collections.Generic;

using MVCFoto.IDAL;
using System.Data.SqlClient;
using System.Data;
namespace MVCFoto.SQLServerDAL
{
    public class AppLog : IAppLog
    {
        
            private const string PARM_LOGID = "@LogID";
            private const string PARM_USERID = "@UserId";
            private const string PARM_OPERATEDATE = "@OperateDate";
            private const string PARM_LOGTYPE = "@LogType";
            private const string PARM_COMMENT = "@Comment";
            private const string PARM_NODE = "@Node";

            public bool Add(int userId, string node, string logType, string comment, DateTime operateDate)
            {
                SqlParameter[] param = {
			            
			            SqlHelper.MakeInParam(PARM_USERID,SqlDbType.Int,4,userId),	
			            SqlHelper.MakeInParam(PARM_OPERATEDATE,SqlDbType.DateTime,0,operateDate),	
			            SqlHelper.MakeInParam(PARM_LOGTYPE,SqlDbType.VarChar,50,logType),	
			            SqlHelper.MakeInParam(PARM_COMMENT,SqlDbType.VarChar,2048,comment),	
			            SqlHelper.MakeInParam(PARM_NODE,SqlDbType.VarChar,50,node)	
                                       };
                return SqlHelper.ExecuteNonQuery("mfp_Insert_AppLog", param) > 0 ? true : false;
            }
    }
}
